package com.wzf.controller;

import com.wzf.entity.User;
import com.wzf.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.multipart.support.AbstractMultipartHttpServletRequest;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping(value = "/register" ,method = RequestMethod.POST)
    public String register(HttpServletRequest request, HttpServletResponse response, User user){
        userService.register(user);
        request.setAttribute("user",user);
        return "ok";
    }

}
